<!DOCTYPE html>
<html>

<head>
<title>添加</title>
<meta http-equiv="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<%include("/common/include.html"){}%>
<style>
	.required{
		display:inline-block;
		width: 93%;
	}
</style>
</head>

<body>
	<div class="easyui-panel" style="width: 100%; height:100%; padding: 30px 60px;">
		<form id="addCode" method="post" class="form">
		<div style="margin-bottom: 20px">
			<label class="label-top">名称:</label>
			<br>
			<div class="required">
				<input id="name" class="easyui-textbox theme-textbox-radius" style="width: 100%;border-color:#FF8400" name="code.name" data-options="prompt:'例：进店方式，服务部位',">
			</div>
			<span style="color:red">*必填项</span>
			<input type="hidden" name="code.parentids" value="${code.parentids! }" />
			<input type="hidden" name="code.level" value="${code.level! }" />
			<input type="hidden" name="code.orderid" value="${code.orderid! }" />
		</div>
		<% if(authUrl("/code/viewCode")){ %>
  		<div style="margin-bottom: 20px">
			<label class="label-top" style="width: 100%; display: block;">代码值:</label>
			<input class="easyui-textbox theme-textbox-radius" style="width: 93%;" name="code.code">
		</div>
		<% } %>
		<div style="margin-bottom: 20px">
			<label class="label-top">是否默认值:</label>
			<br>
			<div class="required">
				<select class="easyui-combobox theme-textbox-radius" name="code.isDefault" labelPosition="top" style="width:100%;border:1px solid #FF8400">
					<option value="0">否</option>
					<option value="1">是</option>
				</select>
			</div>
			<span style="color:red">*必填项</span>
		</div>
		</form>

	</div>

	<script type="text/javascript">
	//@ sourceURL=mmm.js
				var $form = $('#addCode');

				var submitNow = function($dialog, $grid, $tree, $pjq) {
					var url = "${cxt!}/code/addCode";
					$.post(url, sy.serializeObject($form), function(result) {
						if (result.code == '200') {
							var curNode = $tree.getSelectedNodes();
							if (curNode.length>0) {
								curNode[0].isParent = true;
								$tree.reAsyncChildNodes(curNode[0], "refresh");
							}
							$grid.datagrid('reload');
// 							$pjq.messager.alert('提示', "添加成功", 'info');
							$.slideMsg("添加成功！", $pjq);
							$dialog.dialog('destroy');
						} else {
							$.alert($pjq, result.msg);
						}
					}, 'json');
				};
				var submitForm = function($dialog, $grid, $tree, $pjq) {
					submitNow($dialog, $grid, $tree, $pjq);
// 					$form.isValid(function(isValied){
// 						if(isValied){
// 							submitNow($dialog, $grid, $pjq);
// 						}
// 					});
				};
	</script>
</body>
</html>